package Demo;

import java.util.ArrayList;
import java.util.Objects;
import java.util.Random;

public class manage {
    public static ArrayList<Integer> remove_Duplicates(ArrayList<Integer> a){
        ArrayList<Integer> b = new ArrayList<>();
        b.set(0, a.get(0));
        for(int i=1;i<a.size();i++){
            boolean flag = false;
            for (Integer integer : b)
                if (Objects.equals(a.get(i), integer)) {
                    flag = true;
                }
            if(!flag)
                b.add(a.get(i));
        }
        return b;
    }
    public static ArrayList random(){
        Random ran = new Random();
        ArrayList<Integer> b = new ArrayList<>();
        int a = ran.nextInt(20);
        b.add(a);
        do {
            do {
                a = ran.nextInt(20);
            }
            while (a==0);
            boolean flag = false;
            for (Integer integer : b)
                if (a == integer) {
                    flag = true;
                    break;
                }
            if(!flag)
                b.add(a);
        }
        while (b.size()<10);
        return b;
    }
    public static ArrayList sort(ArrayList<Integer> a){
        return a;
    }

    public static void main(String[] args) {
        ArrayList list = new ArrayList<>();
        list = random();
        list = remove_Duplicates(list);
        System.out.println(list.toString());
    }
}
